<template>
  <div>
    <div>公告列表</div>
    <el-card class="box-card" shadow="never">
      <el-button class="btn" type="primary" @click="onSubmit">创建公告</el-button>
      <el-table :data="tableData" border style="width: 100%; margin-bottom: 20px;">
        <el-table-column align="center" prop="date" label="公告id" />
        <el-table-column align="center" prop="name" label="标题" />
        <el-table-column align="center" prop="name" label="创建日期" />
        <el-table-column align="center" prop="address" label="状态" />
        <el-table-column align="center" label="操作">
          <template slot-scope="scope">
            <el-button
              plain
              type="danger"
              @click="handleEdit(scope.$index, scope.row)"
            ><i class="el-icon-edit" />修改</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        size="large"
        style="text-align:right;"
        background
        :page-sizes="[10, 20, 30, 40]"
        layout="sizes, prev, pager, next"
        :current-page.sync="pagination.current"
        :page-size="pagination.pageSize"
        :total="pagination.total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
  </div>
</template>

<script>
export default {
  name: "Announcement",
  data() {
    return {
      formInline: {
        phone: "",
        nickName: ""
      },
      pagination: {
        current: 1,
        pageSize: 10,
        total: 0
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄"
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1517 弄"
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1519 弄"
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1516 弄"
        }
      ]
    };
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange() {},
    // 提交表单
    onSubmit() {
      console.log(this.formInline,`this.formInline`);
    }
  }
};
</script>

<style lang="css" scoped>
.box-card {
    margin-top: 20px;
}
.btn {
    margin-bottom: 20px;
}
</style>
